package com.example.springaop.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
@Component
public class MyAspectDemo {
    @Around("@annotation(com.example.springaop.config.MyAspect)")
    public Object doAround(ProceedingJoinPoint joinPoint){
       log.info("do myaspect before...");
       Object o=null;
       try {
           o=joinPoint.proceed();
       }catch (Throwable e) {
           throw new RuntimeException(e);
       }
       log.info("do myaspect after...");
       return o;
    }
}
